﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LWrap.Search
{
    public class SearchQueryParser
    {
        public Lucene.Net.Search.Query GetQuery(string booleanCondition, string defaultField)
        {
            Lucene.Net.Analysis.Analyzer analyzer = new Lucene.Net.Analysis.Standard.StandardAnalyzer();
            Lucene.Net.QueryParsers.QueryParser qryParser = new Lucene.Net.QueryParsers.QueryParser(defaultField, analyzer);
            Lucene.Net.Search.Query query = qryParser.Parse(booleanCondition);
            
            return query;
        }

        public Lucene.Net.Search.Query GetQuery(string booleanCondition)
        {
            return this.GetQuery(booleanCondition, "");
        }
    }
}
